﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;

namespace INF7GEN
{
    [Serializable()]
    public class Room : ISerializable
    {
        private String internalName = "";
        private String printedName = "";
        private String description = "";
        private bool roomIsDark = false;
        private Room []linkedRooms = new Room[6];//rooms that are neigbors to this room, in this order N E S W U D.



        public Room()
        {
        }


        //--------------------------------------------------------------------
        //Serialization-------------------------------------------------------
        public Room(SerializationInfo info, StreamingContext ctxt)
        {
            this.InternalName = (String)info.GetValue("ROOMInternalName", typeof(String));
            this.LinkedRooms = (Room[])info.GetValue("ROOMLinkedRooms", typeof(Room[]));
            this.PrintedName = (String)info.GetValue("ROOMPrintedName", typeof(String));
            this.RoomIsDark = (bool)info.GetValue("ROOMRoomIsDark", typeof(bool));
            this.Description = (String)info.GetValue("ROOMDescription", typeof(String));
        }

        public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
        {
            info.AddValue("ROOMInternalName", this.InternalName);
            info.AddValue("ROOMLinkedRooms", this.LinkedRooms);
            info.AddValue("ROOMPrintedName", this.PrintedName);
            info.AddValue("ROOMRoomIsDark", this.RoomIsDark);
            info.AddValue("ROOMDescription", this.Description);
        }
        //-------------------------------------------------------------------


        public override string ToString()
        {
            string s = this.InternalName;
            return  "Room: " + s;
        }


        /// <summary>
        /// Room name used for referencing object the games inventory listing
        /// </summary>
        public String InternalName
        {
            get { return internalName; }
            set { internalName = value; }
        }

        public String PrintedName
        {
            get { return this.printedName; }
            set { this.printedName = value; }
        }

        public String Description
        {
            get { return this.description; }
            set { this.description = value; }
        }

        public bool RoomIsDark
        {
            get { return this.roomIsDark; }
            set { this.roomIsDark = value; }
        }

        /// <summary>
        /// rooms that are neigbors to this room, in this order N E S W U D.
        /// </summary>
        public Room[] LinkedRooms
        {
            get { return this.linkedRooms; }
            set { this.linkedRooms = value; }
        }



    }
}